package com.asiainfo.bms.controller;


import com.asiainfo.bms.util.R;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 管理员 控制器
 *
 * @author Horsen
 */
@CrossOrigin
@Api(tags = "登录管理")
@Slf4j
@RestController
@RequestMapping("/user")
public class LoginController {

    /**
     * 登录
     */
    @PostMapping("login")
    public R login() {
        return R.ok().setData("token", "admin");
    }

    /**
     * 获取用户信息
     */
    @GetMapping("info")
    public R info() {
        return R.ok()
                .setData("roles", "[admin]")
                .setData("name", "admin")
                .setData("avatar", "https://oss.aliyuncs.com/aliyun_id_photo_bucket/default_handsome.jpg");
    }

    /**
     * 退出
     */
    @PostMapping("logout")
    public R logout() {
        return R.ok();
    }
}

